package com.powerManager.sdk.handlers;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.powerManager.sdk.common.PagingResult;
import com.powerManager.sdk.common.Security;
import com.powerManager.sdk.utils.JsonUtil;

public class MenuHandler {
	
	public String loadJSON(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String json = "[{\"MenuName\":\"系统管理\"," +
				"\"children\":[{\"MenuName\":\"用户管理\",\"MenuUrl\":\"jsp/systemManager/userManager/userList.jsp\",\"MenuNo\":\"1\",\"MenuIcon\":\"a\",\"text\":\"用户管理\"}," +
				"{\"MenuName\":\"角色管理\",\"MenuUrl\":\"jsp/systemManager/roleManager/roleList.jsp\",\"MenuNo\":\"2\",\"MenuIcon\":\"a\",\"text\":\"角色管理\"}," +
				"{\"MenuName\":\"角色授权\",\"MenuUrl\":\"jsp/systemManager/roleManager/rolePrivilage.jsp\",\"MenuNo\":\"5\",\"MenuIcon\":\"a\",\"text\":\"角色授权\"}," +
				"{\"MenuName\":\"用户授权\",\"MenuUrl\":\"jsp/systemManager/userManager/userPrivilage.jsp\",\"MenuNo\":\"6\",\"MenuIcon\":\"a\",\"text\":\"用户授权\"}," +
				"{\"MenuName\":\"模块管理\",\"MenuUrl\":\"jsp/systemManager/moduleManager/moduleConfig.jsp\",\"MenuNo\":\"3\",\"MenuIcon\":\"a\",\"text\":\"模块管理\"}," +
				"{\"MenuName\":\"部门管理\",\"MenuUrl\":\"jsp/systemManager/userManager/department.jsp\",\"MenuNo\":\"4\",\"MenuIcon\":\"a\",\"text\":\"模块管理\"}," +
				"{\"MenuName\":\"数据权限\",\"MenuUrl\":\"jsp/systemManager/dataManager/dataPrivilege.jsp\",\"MenuNo\":\"7\",\"MenuIcon\":\"a\",\"text\":\"数据权限\"}," +
				"{\"MenuName\":\"规则管理\",\"MenuUrl\":\"jsp/systemManager/dataManager/ruleList.jsp\",\"MenuNo\":\"8\",\"MenuIcon\":\"a\",\"text\":\"规则管理\"}," +
				"{\"MenuName\":\"字段权限\",\"MenuUrl\":\"jsp/systemManager/filedManager/filedConfiguration.jsp\",\"MenuNo\":\"9\",\"MenuIcon\":\"a\",\"text\":\"字段权限\"}" +
				"]}]";
		response.addHeader("content-type", "application/json");
		Security s = (Security)request.getSession().getAttribute("securityUser");
		json = JsonUtil.toJson(s.showMenu());
		return "text:"+json;
	}

}
